import Login from './views/Login.vue'
const NotFound = resolve => require(['./views/404.vue'], resolve);
const Home = resolve => require(['./views/Home.vue'], resolve);
const addProd = resolve => require(['./views/prodManage/addProd.vue'], resolve);
const publishProd = resolve => require(['./views/prodManage/publishProd.vue'], resolve);
const unpublishProd = resolve => require(['./views/prodManage/unpublishProd.vue'], resolve);
const bannerManage = resolve => require(['./views/prodManage/bannerManage.vue'], resolve);
const waitForPay = resolve => require(['./views/orderManage/waitForPay.vue'], resolve);
const payed = resolve => require(['./views/orderManage/payed.vue'], resolve);
const waitForReceive = resolve => require(['./views/orderManage/waitForReceive.vue'], resolve);
const adminManage = resolve => require(['./views/userManage/adminManage.vue'], resolve);
const echarts = resolve => require(['./views/charts/echarts.vue'], resolve);

let routes = [
    {
        path: '/',
        redirect: '/login',
        hidden: true
    },
    {
        path: '/login',
        component: Login,
        name: '',
        hidden: true
    },
    {
        path: '/404',
        component: NotFound,
        name: '',
        hidden: true
    },
    {
        path: '/',
        component: Home,
        name: '商品管理',
        iconCls: 'el-icon-menu',//图标样式class
        children: [
            { path: '/addProd', component: addProd, name: '添加商品' },
            { path: '/publishProd', component: publishProd, name: '商品上架' },
            { path: '/unpublishProd', component: unpublishProd, name: '商品下架' },
            { path: '/bannerManage', component: bannerManage, name: 'banner管理' }
        ]
    },
    {
        path: '/',
        component: Home,
        name: '订单管理',
        iconCls: 'el-icon-edit-outline',
        children: [
            { path: '/waitForPay', component: waitForPay, name: '未付款订单' },
            { path: '/payed', component: payed, name: '待发货订单' },
            { path: '/waitForReceive', component: waitForReceive, name: '已发货订单' }
        ]
    },
    {
        path: '/',
        component: Home,
        name: '',
        iconCls: 'el-icon-service',
        leaf: true,//只有一个节点
        children: [
            { path: '/adminManage', component: adminManage, name: '用户管理' }
        ]
    },
    {
        path: '/',
        component: Home,
        name: 'Charts',
        iconCls: 'el-icon-picture',
        children: [
            { path: '/echarts', component: echarts, name: 'echarts' }
        ]
    },
    {
        path: '*',
        hidden: true,
        redirect: { path: '/404' }
    }
];

const router = new VueRouter({
    routes
});
export default router;
